#pragma once

#include "drawing.h"

namespace Tmpl {

// ===========================================================
// Font class
// ===========================================================

class FontImp;
class Font
{
public:
	enum TextAlign {LEFT, RIGHT, TOP, BOTTOM, CENTER};

	Font();
	Font(const char* fontFile, int size);
	~Font();

	static void InitDefault();

	void LoadFromFile(const char* fontFile, int size);
	void SetYoffset(int offset=-3);
	
	void Print(const char* string, int x, int y, Pixel color, Font::TextAlign halign=Font::LEFT, Font::TextAlign valign=Font::TOP) const;
	int PrintWrap(const char* string, int x, int y, int w, Pixel color, Font::TextAlign halign=Font::LEFT, char forceNewLine=0) const;

	int GetLineCount(const char* string, int w, char forceNewLine=0) const;
	int GetWidth(char chr) const;
	int GetWidth(const char* string, int start=0) const;
	int GetWidth(const char* string, int start, int lengh) const;

	int GetCharPos(const char* string, int x) const;
	int GetHeight() const;

private:
	FontImp* mFont;
};

extern Font TmplFont;
extern Font PixelFont;

}; // namespace Tmpl